<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
	</head>
	<body>
		<div id="box">
			<input type="radio" value="male" v-model="gender">
			<label for="male">男</label>
			<input type="radio" value="female" v-model="gender">
			<label for="female">女</label>
			<p>你的性别是：{{gender}}</p>
			<input type="button" value="填写" @click="edit">
			<p v-show="show"></p>
		</div>

		<script>
			new Vue({
				el: '#box',
				data: {
					gender: '',
					show: false,
				},
				methods: {
					edit: function() {
						this.show = true
						if (this.gender === 'male') {
							alert('你是帅哥！')
						} else if (this.gender == 'female') {
							alert('你是美女！')
						}
					}
				}
			})
		</script>
	</body>
</html>
